package com.itheima.datastructure.binarysearchtree;

import com.itheima.datastructure.binarysearchtree.binarytree.TreeNode;

//给二叉搜索树查找指定节点
public class E03Leetcode700 {
    public TreeNode searchBST(TreeNode node,int val){
        if(node==null){
            return null;
        }
        if(val<node.val){
            return searchBST(node.left,val);
        }else if(val>node.val){
            return searchBST(node.right,val);
        }else{
            return node;
        }
    }
}
